package com.far.game.xiuzhen.common.enums.game;

import com.far.game.xiuzhen.common.interf.IEnums;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/*
 * @description: 种族
 * @author mike/Fang.J/Q184377367
 * @date 2022/7/27 21:49
 */
public enum RaceEnums implements IEnums {

    //人
    REN("人", 1),
    //妖
    YAO("妖", 2),
    //灵
    LING("灵", 3),
    //魔
    MO("魔", 4);


    private int val;
    private String name;

    public int getVal() {
        return val;
    }

    public void setVal(int val) {
        this.val = val;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    RaceEnums(String name, int val) {

        this.name = name;
        this.val = val;
    }



    public static  int valueOfName(String name){
        List<RaceEnums> data =  Arrays.stream(RaceEnums.values()).filter(e->{
            return e.getName().equals(name);
        }).collect(Collectors.toList());
        return data.get(0).getVal();
    }

}
